package com.qianzhou.product.controller;

import com.qianzhou.common.pojo.Products;
import com.qianzhou.product.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: qian.zhou
 * @Description: ProductController
 * @Date Created in 2021-09-12-9:43
 * @Modified By:
 */
@RestController
@RequestMapping("/product")
public class ProductController {
    @Autowired
    private ProductService productService;
    @Value("${server.port}")
    private Integer port;

    @RequestMapping("/query/{id}")
    public Products query(@PathVariable("id") Integer id) {
        System.out.println("得到的端口号为：" + port);
        return productService.findProductsById(id);
    }
}
